package com.lxp.base.net.self;

import android.support.annotation.NonNull;

import com.lxp.base.net.okhttp.OkHttpImpl;


/**
 * @author liuxiaopeng
 * @version V1.0.0
 * @time 2016/12/4
 * @describe HTTP请求工厂
 */

public class HttpFactory {
    private static HttpFactory instance;

    private HttpFactory() {
    }

    /**
     * 获取HTTP工厂实例
     *
     * @return 获取HTTP工厂实例
     */
    public synchronized static HttpFactory getInstance() {
        if (null == instance) {
            instance = new HttpFactory();
        }
        return instance;
    }

    /**
     * 获取 HTTP
     *
     * @param type 类型
     * @return
     */
    public IBaseHttp getHttp(@NonNull HttpType type) {
        IBaseHttp http = null;
        switch (type) {
            case XUTILS3:
                break;
            case DEFAULT:
            default:
            case OKHTTP:
                http = new OkHttpImpl();
                break;
        }

        return http;
    }


    /**
     * 请求库类型
     */
    public enum HttpType {
        OKHTTP,
        DEFAULT,
        XUTILS3
    }
}
